<?
session_start();
require_once('config.php');
require_once('connect.php');

	$username = mysql_real_escape_string($_POST['gebruikersnaam']);
	$password = $_POST['paswoord'];

	$sql = "SELECT * FROM ".$pre."_Users"." WHERE lName = '".$username."' AND uPassword = '".$password."'";
	$res = mysql_query($sql);
	$rows = mysql_num_rows($res);
	if ($rows > 0) {
		$data = mysql_fetch_object($res);
		$_SESSION['userid'] = $data->userNumber;
		$_SESSION['voornaam'] = $data->fName;
		$_SESSION['achternaam'] = $data->uName;
		$_SESSION['ingelogd'] = 1;
		echo ("Welkom : ".$_SESSION['voornaam'] . " ". $_SESSION['achternaam']).' &#166; <a href="library/logout.php">Logout</a>';
	}else{	
		$_SESSION['ingelogd'] = false;
		echo 'To bad, try again'; 
		echo '<br/>';
		echo '<a href="index.php">goto login</a>';
	}

?>
